1import { Label, List, Markdown, Navigation, NavigationStack, Script, Section, Text, VStack } from "scripting"
2
3function View() {
4 return <NavigationStack>
5 <List>
6 <Section title={"Text"}>
7 <VStack>
8 <Text
9 font={"title"}
10 foregroundStyle={"systemRed"}
11 >
12 Title
13 </Text>
14 <Text
15 font={"body"}
16 foregroundStyle={"systemBlue"}
17 >Hello Scripting!</Text>
18 <Text
19 foregroundStyle={"systemGreen"}
20 font={"footnote"}
21 italic
22 >
23 This is a footnote.
24 </Text>
25 </VStack>
26 </Section>
27
28 <Section title="AttributedString">
29 <Text
30 attributedString={`This is regular text.
31* This is **bold** text, this is *italic* text, and this is ***bold, italic*** text.
32~~A strikethrough example~~
33\`Monospaced works too\`
34Visit Apple: [click here](https://apple.com)`}
35 />
36 </Section>
37
38 <Section title={"Label"}>
39 <Label
40 title={"Hello world"}
41 systemImage={"globe"}
42 />
43 </Section>
44
45 <Section title={"Markdown"}>
46 <Markdown
47 content={`
48# Scripting App
49Run your *ideas* quickly **with** scripts.
50 `}
51 />
52 </Section>
53
54 <Section title={"RichText"}>
55 <Text
56 font={16}
57 styledText={{
58 content: [
59 "I agree the ",
60 {
61 content: "Terms",
62 foregroundColor: "systemOrange",
63 underlineColor: "systemBlue",
64 bold: true,
65 onTapGesture: () => {
66 Dialog.alert({
67 message: "OK!"
68 })
69 }
70 }
71 ]
72 }}
73 />
74 </Section>
75
76 </List>
77 </NavigationStack>
78}
79
80async function run() {
81 await Navigation.present(<View />)
82 Script.exit()
83}
84
85run()